﻿@using Dentiste.Domain.Factories
@using Dentiste.Domain.Interfaces
@model Dentiste.UI.Models.IndexViewModel
@{
    ViewBag.Title = "Encodage";
    ViewBag.BodyId = "encode";
    Layout = "../_Layout.cshtml";
}

<h2>Cr&eacute;er une d&eacute;claration de soin</h2>

@{
    IRow rawRow = new Factory<IRow>().Create();
}
@Html.Partial("../Partial/ToothPicker")
<div id="name-container">
    <input type="text" name="Nom" placeholder="Nom" id="lastName" value="@Model.LastName"/>
    <input type="text" name="Prenom" placeholder="Pr&eacute;nom" id="firstName" value="@Model.FirstName"/>
    <button class="btn-mini btn-success" id="patientValid">Valider le changement de nom</button>
    <input type="hidden" value="@Model.Invoice.Id" id="invoiceId"/>
</div>
<div id="row_container">
    @foreach (IRow i in Model.Invoice.Rows)
    {
        @Html.Partial("../Partial/RowPartial", i)
    }
    @Html.Partial("../Partial/RowPartial", rawRow)
    <div class="validation-button">
        <a href="/home/addRow" class="btn btn-success" id="addRow">Valider la ligne</a>
        <div class="loaderContainer">
            <div id="AddLoader" class="loader">
                <p>
                    Ajout en cours ...
                </p>
                <div class="ball"></div>
            </div>
        </div>
    </div>
    <div id="print-buttons">
        <div class="btn-group">
            <a href="/print/index/@Model.Invoice.Id?printtype=none" class="btn btn-info btn-print">Impression</a>
            <a href="/print/index/@Model.Invoice.Id?printtype=none"><button class="btn"><i class="icon-print"></i></button></a>
        </div>
        <div class="btn-group">
            <a href="/print/index/@Model.Invoice.Id?printtype=vipo" class="btn btn-warning btn-print">Impression VIPO</a>
            <a href="/print/index/@Model.Invoice.Id?printtype=vipo"><button class="btn"><i class="icon-print"></i></button></a>
        </div>
    </div>
</div>
@{
    var somme1 = 0.0;
    var somme2 = 0.0;
    var somme3 = 0.0;
    foreach (var row in Model.Invoice.Rows)
    {
        somme1 += row.Inami.Prix1;
        somme2 += row.Inami.Prix2;
        somme3 += row.Inami.Prix3;
    }
}
<p>
    Montant remboursé par la mutuelle : <span id="zone_montant1">@somme1</span>&euro;.<br/>
    Montant demandé pour la prestation : <span id="zone_montant2">@somme2</span>&euro;.<br/>
    Montant conventionné VIPO : <span id="zone_montant3">@somme3</span>&euro;.
</p>

@section Menu {
<ul class="nav nav-pills">
        <li class="active"><a href="javascript:void(0)">Encoder une d&eacute;claration de soin</a></li>
        <li class="dropdown">
            <a class="dropdown-toggle" data-toggle="dropdown" href="#">
                G&eacute;rer les codes Inami
                <b class="caret"></b>
            </a>
            <ul class="dropdown-menu">
                <li><a href="/InamiManager/Add">Ajouter un nouveau code Inami</a></li>
                <li><a href="/InamiManager/Edit">Modifier un code Inami</a></li>
                <li><a href="/InamiManager/Delete">Supprimer un code Inami</a></li>
            </ul>
        </li>
    </ul>
}